import unittest
from unittest import TestCase

from animal_chess import ChessType, ChessColor, ChessError
from animal_chess.chess import ChessBoard, Chess


class ChessTest(TestCase):

    def setUp(self):
        super().setUp()

    def tearDown(self):
        super().tearDown()

    def test_chess_board(self):
        chess_board = ChessBoard()
        for cs in chess_board.chesses:
            for c in cs:
                print(c, end=' ')
            print()

    def test_eat_chess(self):
        chess_board = ChessBoard()
        chess_board.chesses[0][0] = Chess(type=ChessType.FOOTBALL, color=ChessColor.RED, hidden=False, x=0, y=0)
        chess_board.chesses[1][0] = Chess(type=ChessType.MOUSE, color=ChessColor.BLUE, hidden=False, x=1, y=0)
        chess_board.chesses[2][0] = Chess(type=ChessType.WOLF, color=ChessColor.BLUE, hidden=False, x=2, y=0)
        chess_board.chesses[3][0] = Chess(type=ChessType.ELEPHANT, color=ChessColor.RED, hidden=False, x=3, y=0)
        with self.assertRaises(ChessError):
            chess_board.eat_chess(0, 0, 3, 0)

    def test_chess_type(self):
        self.assertFalse(ChessType.MOUSE >= ChessType.WOLF)


if __name__ == '__main__':
    unittest.main()
